<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<%@ taglib prefix="s" uri="/struts-tags"  %> 
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
 
<sx:head parseContent="true"/>
<link rel="stylesheet" type="text/css" href="assets/skins/sam/container.css" />
<link rel="stylesheet" type="text/css" href="assets/skins/sam/button.css" />

<script type="text/javascript" src="js/yui/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="js/yui/connection/connection-min.js"></script>
<script type="text/javascript" src="js/yui/json/json-min.js"></script>
<script type="text/javascript" src="js/yui/element/element-min.js"></script>
<script type="text/javascript" src="js/yui/animation/animation-min.js"></script>
<script type="text/javascript" src="js/yui/container/container-min.js"></script>
<script type="text/javascript" src="js/yui/button/button-min.js"></script>
<script type="text/javascript" src="js/yui/event/event-min.js"></script>
<script type="text/javascript">
    function process(taskName){
        var callback = {
            success : function(o) {
                if(o.responseText == "R"){
                    document.getElementById("divStatus").innerHTML = "<img src='images/indicator.gif'><br><br>Running ...";
                } else{
                    document.getElementById("divStatus").innerHTML = "<img src='images/finish.gif' width='54' height='49'><br><br>Stop";
                }
            },
            failure : function(o) {
                document.getElementById("divStatus").innerHTML = "Error ...";
            }
        }
        var conn = YAHOO.util.Connect.asyncRequest("GET", "${pageContext.request.contextPath}/EmailScheduler_" + taskName + ".action", callback);
    }
</script>

<tiles:insertDefinition name="baseLayout">
<tiles:putAttribute name="body" type="String">
    <div id="container">
        <table width="100%" border="0" >
        <tr>
            <td>
                <h1>Hello World !</h1>
            </td>
        </tr>
        </table>
    </div>
    <br><br>
    <div id="divStatus"></div>
    <br><br>
    <input type="button" name="btnStart" value=" Start " onclick="process('testStart')" style="border: 1px #999999 solid;">
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    <input type="button" name="btnPause" value=" Pause " onclick="process('testPause')" style="border: 1px #999999 solid;">
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    <input type="button" name="btnResume" value=" Resume " onclick="process('testResume')" style="border: 1px #999999 solid;">
</tiles:putAttribute>
</tiles:insertDefinition>
